package ae.pcfc.etks.online.itworx.ehs.web.enums;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.WordUtils;

public enum RequestAction {

	Reject("Reject"),
	SendMail("Send Mail"),
	Cancel("Cancel"), 
	Close("Close"), 
	Submit("Submit"),
	Resubmit("Submit"),
	ReturnForUpdate("Return For Updates"),
	Approve("Approve"),
	PaymentDone("Payment Done"),
	PaymentConfirmed("Payment Confirmed"),
	AdditionalPaymentDone("Additional Payment Done"),
	REINSPECTION_REQUIRED("Non-Compliance Comments Exist"),
	INSPECTION_IN_PROGRESS("Inspection In Progress"),
	INSPECTION_CLOSED("Inspection Closed"),
	ADDITIONAL_FEES_REQUIRED("Additional Fees Required"),
	ADDITIONAL_Payment_Confirmed("Additional Payment Confirmed"),
	REPLY_COMMENTS("Reply Comments");
	
	private String actionName;
	
	private static Map<String, RequestAction> actionsMap = new HashMap<String, RequestAction>();
	private static Map<RequestAction, RequestStatus> statusMap = new HashMap<RequestAction, RequestStatus>();
	static {
		actionsMap.put(Reject.getActionName(), Reject);
		actionsMap.put(SendMail.getActionName(), SendMail);
		actionsMap.put(Cancel.getActionName(), Cancel);
		actionsMap.put(Close.getActionName(), Close);
		actionsMap.put(Submit.getActionName(), Submit);
		actionsMap.put(Resubmit.getActionName(), Resubmit);
		actionsMap.put(ReturnForUpdate.getActionName(), ReturnForUpdate);
		actionsMap.put(Approve.getActionName(), Approve);	
		actionsMap.put(PaymentDone.getActionName(), PaymentDone);
		actionsMap.put(PaymentConfirmed.getActionName(), PaymentConfirmed);
		actionsMap.put(AdditionalPaymentDone.getActionName(), AdditionalPaymentDone);	
		actionsMap.put(REINSPECTION_REQUIRED.getActionName(), REINSPECTION_REQUIRED);
		actionsMap.put(INSPECTION_IN_PROGRESS.getActionName(), INSPECTION_IN_PROGRESS);
		actionsMap.put(INSPECTION_CLOSED.getActionName(), INSPECTION_CLOSED);
		actionsMap.put(ADDITIONAL_FEES_REQUIRED.getActionName(), ADDITIONAL_FEES_REQUIRED);
		actionsMap.put(ADDITIONAL_Payment_Confirmed.getActionName(), ADDITIONAL_Payment_Confirmed);
		actionsMap.put(REPLY_COMMENTS.getActionName(), REPLY_COMMENTS);
	}
	
	private RequestAction(String name){
		this.actionName=name;		
	}
	
	public String getActionName(){
		return actionName;
	}
	
	public static  RequestAction getRequestAction(String actionName){
		return actionsMap.get(WordUtils.capitalize(actionName.replaceAll("_"," ")));
	}
	
	public static  RequestStatus getAssociatedStatus(RequestAction actino){
		return statusMap.get(actino);
	}
}
